package cmlabs.generalutils;

/**
 * Created by IntelliJ IDEA.
 * User: jte
 * Date: 9.4.11
 * Time: 18.24
 * To change this template use File | Settings | File Templates.
 */

public class Pair<T extends Number> implements Comparable<Pair<T> > {
    public T first, second;

    public Pair(T first, T second) {
        this.first = first;
        this.second = second;
    }

    public int compareTo(Pair another) {
        int result = (int) Math.signum(this.first.doubleValue() -  another.first.doubleValue());
        if (result == 0){
            return (int) Math.signum(this.second.doubleValue() -  another.second.doubleValue());
        }
        else{
            return result;
        }
    }
}
